package com.huawei.appgallery.serverreqkit.api.bean;

import com.huawei.appgallery.jsonkit.api.JsonBean;
import org.json.JSONObject;

public class ResponseBean extends JsonBean {
    public static final int ERROR = 1;
    public static final int NETWORK_ERROR = 3;
    public static final int NOT_AGREE_PROTOCOL_ERROR = -403;
    public static final int NOT_FOUND = 404;
    public static final int OK = 0;
    public static final int PARSE_ERROR = 4;
    public static final int READ_CACHE_ERROR = 6;
    public static final int REQ_PARAM_ERROR = 5;
    public static final int RTN_CODE_OK = 0;
    public static final int SERVER_DELAY_RETRY = 503;
    public static final int SERVER_UPGRADES_ERROR = 537;
    public static final int SERVICE_ZONE_NOT_SUPPORT_ERROR = -405;
    public static final int TIMEOUT = 2;
    private int dnsFailType = 0;
    private boolean dnsReachable = true;
    private e errCause = e.NORMAL;
    private int httpStatusCode = -1;
    private int responseCode = 1;
    private a responseType = a.FROM_NETWORK;
    private int rtnCode_ = 0;
    private String rtnDesc_;

    public enum a {
        FROM_CACHE,
        REF_CACHE,
        UPDATE_CACHE,
        FROM_NETWORK
    }

    public enum e {
        NORMAL,
        NO_NETWORK,
        JSON_ERROR,
        PARAM_ERROR,
        EMPTY_RESDATA,
        IO_EXCEPTION,
        CONNECT_EXCEPTION,
        UNKNOWN_EXCEPTION,
        SERVER_UPGRADES,
        NOT_AGREE_PROTOCOL,
        ZONE_NOT_SUPPORT,
        NSPKEY_EMPTY,
        NSPKEY_INVALID,
        NSPKEY_EXECPTION,
        SERVER_FLOW_CONTROL
    }

    public static int getResponseCode(ResponseBean responseBean) {
        return responseBean.getResponseCode();
    }

    public static void setResponseCode(ResponseBean responseBean, int i) {
        responseBean.setResponseCode(i);
    }

    public static void setErrCause(ResponseBean responseBean, e eVar) {
        responseBean.setErrCause(eVar);
    }

    public static void setResponseType(ResponseBean responseBean, a aVar) {
        responseBean.setResponseType(aVar);
    }

    public static String getSafeData(ResponseBean responseBean) {
        return responseBean.getSafeData();
    }

    public static a getResponseType(ResponseBean responseBean) {
        return responseBean.getResponseType();
    }

    public static int getRtnCode_(ResponseBean responseBean) {
        return responseBean.getRtnCode_();
    }

    public static void setHttpStatusCode(ResponseBean responseBean, int i) {
        responseBean.setHttpStatusCode(i);
    }

    public String toString() {
        return "ResponseBean{" + "responseType=" + this.responseType + ", responseCode=" + this.responseCode + ", rtnCode_=" + this.rtnCode_ + ", dnsFailType=" + this.dnsFailType + ", dnsReachable=" + this.dnsReachable + ", errCause=" + this.errCause + '}';
    }

    public boolean isDnsReachable() {
        return this.dnsReachable;
    }

    public void setDnsReachable(boolean z) {
        this.dnsReachable = z;
    }

    public int getDnsFailType() {
        return this.dnsFailType;
    }

    public void setDnsFailType(int i) {
        this.dnsFailType = i;
    }

    public a getResponseType() {
        return this.responseType;
    }

    public void setResponseType(a aVar) {
        this.responseType = aVar;
    }

    public int getResponseCode() {
        return this.responseCode;
    }

    public void setResponseCode(int i) {
        this.responseCode = i;
    }

    public int getRtnCode_() {
        return this.rtnCode_;
    }

    public void setRtnCode_(int i) {
        this.rtnCode_ = i;
    }

    public e getErrCause() {
        return this.errCause;
    }

    public void setErrCause(e eVar) {
        this.errCause = eVar;
    }

    public int getHttpStatusCode() {
        return this.httpStatusCode;
    }

    public void setHttpStatusCode(int i) {
        this.httpStatusCode = i;
    }

    public String getRtnDesc_() {
        return this.rtnDesc_;
    }

    public void setRtnDesc_(String str) {
        this.rtnDesc_ = str;
    }

    public ResponseBean parse(String str, String str2) throws Exception {
        fromJson(new JSONObject(str2));
        setResponseCode(0);
        return this;
    }
}
